package com.ruoyi.cmemetal.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.cmemetal.domain.ZxPostProcess;
import com.ruoyi.cmemetal.service.IZxPostProcessService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * postprocessController
 * 
 * @author ruoyi
 * @date 2022-01-01
 */
@RestController
@RequestMapping("/postprocess/postprocess")
public class ZxPostProcessController extends BaseController
{
    @Autowired
    private IZxPostProcessService zxPostProcessService;

    /**
     * 查询postprocess列表
     */
    @PreAuthorize("@ss.hasPermi('postprocess:postprocess:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZxPostProcess zxPostProcess)
    {
        startPage();
        List<ZxPostProcess> list = zxPostProcessService.selectZxPostProcessList(zxPostProcess);
        return getDataTable(list);
    }

    /**
     * 导出postprocess列表
     */
    @PreAuthorize("@ss.hasPermi('postprocess:postprocess:export')")
    @Log(title = "postprocess", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZxPostProcess zxPostProcess)
    {
        List<ZxPostProcess> list = zxPostProcessService.selectZxPostProcessList(zxPostProcess);
        ExcelUtil<ZxPostProcess> util = new ExcelUtil<ZxPostProcess>(ZxPostProcess.class);
        util.exportExcel(response, list, "postprocess数据");
    }

    /**
     * 获取postprocess详细信息
     */
    @PreAuthorize("@ss.hasPermi('postprocess:postprocess:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zxPostProcessService.selectZxPostProcessById(id));
    }

    /**
     * 新增postprocess
     */
    @PreAuthorize("@ss.hasPermi('postprocess:postprocess:add')")
    @Log(title = "postprocess", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZxPostProcess zxPostProcess)
    {
        return toAjax(zxPostProcessService.insertZxPostProcess(zxPostProcess));
    }

    /**
     * 修改postprocess
     */
    @PreAuthorize("@ss.hasPermi('postprocess:postprocess:edit')")
    @Log(title = "postprocess", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZxPostProcess zxPostProcess)
    {
        return toAjax(zxPostProcessService.updateZxPostProcess(zxPostProcess));
    }

    /**
     * 删除postprocess
     */
    @PreAuthorize("@ss.hasPermi('postprocess:postprocess:remove')")
    @Log(title = "postprocess", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zxPostProcessService.deleteZxPostProcessByIds(ids));
    }
}
